home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / owldbf.zip / DIALTEST.CPP < prev    next >
C/C++ Source or Header  |  1992-11-24  |  2KB  |  78 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. #include <owl.h>
  4. #include <dialog.h>
  5. #include <edit.h>
  6. #include "dialtest.h"
  7. void CreateTable(HWND&);
  8. BOOL TableHasChanged = True; // not implemented yet
  9. class TTestDialog : public TDialog
  10. {
  11.  // edit control will be used to allow user to enter data for table
  12. // PTEdit editptr;
  13. public:
  14.   TTestDialog(PTWindowsObject AParent, LPSTR AName)
  15.     : TDialog(AParent, AName)
  16.     {
  17. //     editptr = new TEdit(this, 101, 256 );
  18.      CreateTable((HWND)Parent->HWindow);// pass parent's handle because
  19.                     // we're not created yet. The handle
  20.                     // is used by MessageBox to display
  21.                                         // Engine errors
  22.     };
  23.   virtual void Ok(RTMessage Msg)
  24.   = [ID_FIRST + IDOK];
  25.   
  26. };
  27. // this function will be used to prompt user for
  28. // saving changes to the database
  29. void TTestDialog::Ok( RTMessage Msg )
  30.  {
  31. //     editptr->GetText( InfoBuffer, 256 );
  32.      if( TableHasChanged )
  33.      MessageBox(HWindow, "Save Changes?", "Table has Changed", MB_OKCANCEL);
  34.      TDialog::Ok(Msg);
  35.   }
  36. class TTestWindow : public TWindow
  37. {
  38. public:
  39.   TTestWindow(PTWindowsObject AParent, LPSTR ATitle);
  40.   virtual void CMTest(RTMessage Msg)
  41.     = [CM_FIRST + CM_TEST];
  42. };
  43.  
  44. class TTestApp : public TApplication
  45. {
  46. public:
  47.   TTestApp(LPSTR AName, HINSTANCE hInstance, HINSTANCE hPrevInstance,
  48.     LPSTR lpCmdLine, int nCmdShow) :
  49.     TApplication(AName, hInstance, hPrevInstance, lpCmdLine, nCmdShow) {};
  50.   virtual void InitMainWindow();
  51. };
  52.  
  53.  
  54. TTestWindow::TTestWindow(PTWindowsObject AParent, LPSTR ATitle)
  55.   : TWindow(AParent, ATitle)
  56. {
  57.   AssignMenu("COMMANDS");
  58. }
  59.  
  60. void TTestWindow::CMTest(RTMessage)
  61. {
  62.   GetApplication()->ExecDialog(new TTestDialog(this, "TESTDIALOG"));
  63. }
  64.  
  65. void TTestApp::InitMainWindow()
  66. {
  67.   MainWindow = new TTestWindow(NULL, Name);
  68. }
  69.  
  70. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  71.   LPSTR lpCmdLine, int nCmdShow)
  72. {
  73.   TTestApp TestApp("Dialog Tester", hInstance, hPrevInstance,
  74.     lpCmdLine, nCmdShow);
  75.   TestApp.Run();
  76.   return (TestApp.Status);
  77. }
  78.